import torch
import torch.nn as nn
import torch.nn.functional as F

class GRU(nn.Module):
    def __init__(self, feature_size, hidden_size, num_layers, output_size):
        super(GRU, self).__init__()
        self.hidden_size = hidden_size
        self.num_layers = num_layers
        self.gru = nn.GRU(feature_size, hidden_size, num_layers, batch_first=True).cuda()
        self.fc = nn.Linear(hidden_size, output_size).cuda()
        self.fc1 = nn.Linear(output_size, output_size).cuda()
        self.dropout = nn.Dropout(p=0.9)

    def forward(self, x):
        """27 """
        x = self.dropout(x)
        output, _ = self.gru(x)
        output = self.dropout(output)
        output = F.relu(output)
        output = self.fc(output[:, -1, :])
        output = nn.Tanh()(output)
        output = self.dropout(output)

        return output